package org.zhangsh.spring.beanpostprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * </p>
 *
 * @author zhangsh
 * @version 1.0.0
 * @since 2019-03-27
 */
@Component
public class DemoBeanPostProcessor implements BeanPostProcessor {

    public DemoBeanPostProcessor(){
        System.out.println("我是BeanPostProcessor init...");
    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

//        System.out.println(beanName + " BeanPostProcessor(postProcessBeforeInitialization)实例化");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

//        System.out.println(beanName + " BeanPostProcessor(postProcessAfterInitialization)实例化");
        return bean;
    }
}
